/*
 * Copyright 2013 NJUT  qixiaobo. All rights reserved.
 */
package com.fujitsu.nanjing.tieba.view.velocity.tools;

import org.apache.velocity.tools.config.DefaultKey;
import org.apache.velocity.tools.generic.SafeConfig;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.context.annotation.DependsOn;
import org.springframework.context.annotation.Scope;

import com.fujitsu.nanjing.tieba.service.BoardService;

/**
 * BoardTool.java
 * 
 * @author Administrator
 */
@Configurable("boardTool")
@DefaultKey("boardTool")
@Scope
@DependsOn
public class BoardTool extends SafeConfig {
	private BoardService boardService;

	public BoardService getBoardService() {
		return boardService;
	}

	public void setBoardService(BoardService boardService) {
		this.boardService = boardService;
	}

	public String getBoardName(String boardid) {
		if (boardid == null || boardid.trim().equals("")) {
			return "未知";
		}
		return boardService.findById(boardid).getBoardname();
	}
}
